<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable = [
        'name',
        'description',
        'image',
        'price',
        'uuid',

    ];

    protected $with = ['skus'];

    public function machines()
    {
        return $this->belongsToMany(Machine::class, 'product_machines', 'product_id', 'machine_id');
    }

    public function skus()
    {
        return $this->hasMany(ProductSku::class, 'product_id');
    }

    public function category()
    {
        return $this->belongsTo(Category::class, 'category_id');
    }
}
